import { ref, computed } from 'vue'
import { defineStore } from 'pinia'

export const userStore = defineStore('user', () => {
  //定义数据状态
  const token = ref<string>('')
  const userInfo = ref<{
    avatar:string,
    gender:number,
    id:number,
    nickname:string,
    username:string,
    proid:string,
  } | {}>({})
  //定义方法
  function setToken(data:string) {
    token.value=data
  }
  function setUserInfo(data:any) {
    userInfo.value=data
  }

  return { token, userInfo, setToken, setUserInfo}
})
